home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 September / CHIP Eylül 1998.iso / Slackwar / contrib / java / Java-Linux-1.1.1-HOWTO.txt next >
Text File  |  1997-05-30  |  14KB  |  371 lines

  1.   Java-Linux 1.1.1 HOWTO
  2.   Karl Asha, karl@blackdown.org
  3.   18 May 1997
  4.  
  5.   This is a draft version of the JDK-1.1.1 Howto for Linux.
  6.   ______________________________________________________________________
  7.  
  8.   Table of Contents:
  9.  
  10.   1.      Installing the JDK 1.1.1
  11.  
  12.   1.1.    Overview
  13.  
  14.   1.2.    Required Libraries
  15.  
  16.   1.3.    Retrieving the JDK 1.1.1 for Linux
  17.  
  18.   1.4.    Installing the JDK 1.1.1 for Linux
  19.  
  20.   1.5.    Required System Settings
  21.  
  22.   1.6.    Motif - Static vs. Dynamic
  23.  
  24.   1.7.    Problems and Bug Reporting
  25.  
  26.   1.8.    Further Reading
  27.  
  28.   2.      JDK-1.1.1 Release Notes
  29.  
  30.   2.1.    jdb
  31.  
  32.   3.      Using Java Binary Format Support in the Linux kernel
  33.  
  34.   3.1.    Configuring the Kernel
  35.  
  36.   3.2.    Making Use of Java Binary Support
  37.  
  38.   3.3.    Further Reading
  39.  
  40.   4.      Netscape and Java
  41.  
  42.   4.1.    Netscape 3.0
  43.  
  44.   4.2.    Netscape 4.0
  45.  
  46.   5.      Marimba's Tuner, Transmitter, and Bongo
  47.   ______________________________________________________________________
  48.  
  49.   1.  Installing the JDK 1.1.1
  50.  
  51.   1.1.  Overview
  52.  
  53.   The JDK 1.1.1 package for Linux is available from an extensive list of
  54.   volunteer mirror sites.
  55.  
  56.   It is assumed that the end user's system is capable of running ELF
  57.   binaries. At this point, ELF is now beyond the scope of this document.
  58.  
  59.   1.2.  Required Libraries
  60.  
  61.   The current build of the JDK 1.1.1 for linux is packaged with the
  62.   neccessary Standard C Library and Linux Dynamic Loader Library needed
  63.   to operate the supporting binaries.
  64.  
  65.   The end user is responsible for ensuring that the XFree86 Libraries
  66.   are installed on his system.
  67.  
  68.   The JDK 1.1.1 for Linux was created under the following environment.
  69.  
  70.      Libary Revisions
  71.  
  72.      o  libc version 5.4.13
  73.  
  74.      o  ld.so version 1.8.5
  75.  
  76.      o  XFree86 version 3.1.2
  77.  
  78.   In case your system requires an updated XFree86 installation, the
  79.   required packages can be found at
  80.   <ftp://tsx-11.mit.edu/pub/linux/packages/X11/>. Please view the README
  81.   file there for more information on the XFree86 distribution.
  82.  
  83.   For a summary of which libraries are currently installed on your
  84.   system, type ldconfig -v.
  85.  
  86.   Technical details, programming information, and installation
  87.   instructions for these packages is beyond the scope of this document.
  88.  
  89.   1.3.  Retrieving the JDK 1.1.1 for Linux
  90.  
  91.   Three different packages for using Java under Linux can be found on
  92.   mirror sites. Please visit http://www.javasoft.com
  93.   <http://www.javasoft.com> for licensing information on bundling the
  94.   JRE with your own Java applications.
  95.  
  96.   The JavaSoft documentation, demonstration classes, and src.zip for the
  97.   JDK 1.1.1 are distributed in a separate package.
  98.   (jdk1.1.1-doc+demo.tar.gz)
  99.  
  100.      JDK - Java Developer's Kit
  101.         This package includes everything neccessary to run and compile
  102.         Java programs under Linux.
  103.  
  104.      JRE - Java Runtime Environment
  105.         The JRE is a runtime system meant to be bundled with
  106.         applications.  It includes everything needed to run (but not
  107.         compile or debug) Java programs. The JRE includes all character
  108.         converters for full internationalization support.
  109.  
  110.      RT - Separated Java Runtime Environment
  111.         In the RT package, the internationalization support and basic
  112.         runtime VM are separated into two directories, rt and i18n.  The
  113.         rt directory provides everything needed to execute Java
  114.         applications in ISO-Latin-1 environments. The i18n directory
  115.         contains the optional byte to character converters for different
  116.         global character encoding schemes. In the JRE package, these two
  117.         directores are combined into one.
  118.  
  119.   The current list of recognized mirrors is available at
  120.   <http://www.blackdown.org/java-linux/Mirrors.html>.
  121.  
  122.   1.4.  Installing the JDK 1.1.1 for Linux
  123.  
  124.   By tradition, all one needs to do in order to install the JDK is to
  125.   select a directory, such as /usr/local/, and unpack the selected
  126.   archive. Once installed, adding (in this case)
  127.   /usr/local/jdk1.1.1/bin/ to your PATH will allow you to make use of
  128.   the Developer's Kit.
  129.  
  130.   Unfortunately, controversy recently surrounded the selection of a home
  131.   for the JDK when used under Linux. The location, in all honesty, is
  132.   merely a matter of decoration. What remains important is that you set
  133.   the JDK_HOME variable to point to a directory that contains the bin/,
  134.   lib/, and classes/ subdirectories of the JDK.
  135.  
  136.   All future packages distributed by the Java-Linux community will rely
  137.   on this variable to find the neccessary support binaries and class
  138.   libraries.
  139.  
  140.   1.5.  Required System Settings
  141.  
  142.      CLASSPATH Settings
  143.         The CLASSPATH environment variable is used to tell the JDK where
  144.         to look for classes. Sometimes, an incorrect setting may impede
  145.         successful execution of the JDK tools. If you experience any
  146.         problems using the JDK, make sure that the CLASSPATH variable is
  147.         not set before you try running java, javac, or the appletviewr.
  148.  
  149.      Device Permissions
  150.         Before using the JDK, ensure that the special device /dev/zero
  151.         is world readable and writeable. In order to do this, simply
  152.         issue the following command as the superuser:
  153.  
  154.         chmod 666 /dev/zero
  155.  
  156.      Swap Space
  157.         The JDK attempts to pre allocate a large chunk of memory when it
  158.         starts.  Always be certain that your system has at least 20
  159.         Megabytes of free swap space before running any of the
  160.         executables provided with the Java Developers Kit.
  161.  
  162.         You can control the amount of memory the java interpreter uses
  163.         by experiementing with the -mx and -ms flags. Further
  164.         information on these settings is available from the JDK manual
  165.         pages.
  166.  
  167.   1.6.  Motif - Static vs. Dynamic
  168.  
  169.   Prior to the JDK 1.1.1, two separate packages were released to the
  170.   Java-Linux community, one of which was statically linked with Motif.
  171.  
  172.   Although the JDK 1.1.1 dynamically linked with Motif is not currently
  173.   supported, there are ways to make use of your Motif shared libraries.
  174.  
  175.   Setting the NS_JAVA environment variable to a non-zero value, such as
  176.   to be used. This scheme allows you to use the JDK without having the
  177.   XFree86 distribution installed. It also allows use of a shared Motif
  178.   library.
  179.  
  180.   In order to use your shared Motif libraries, you must make use of the
  181.   LD_PRELOAD environment variable. Preloaded libraries must include
  182.   Motif and all neccessary XFree86 libraries.
  183.  
  184.          For example:
  185.  
  186.            export NS_JAVA=true
  187.            export LD_PRELOAD=/usr/X11R6/lib/libXm.so.2.0:\
  188.            /usr/X11R6/lib/libX11.so.6.1
  189.  
  190.   1.7.  Problems and Bug Reporting
  191.  
  192.   If you discover a what might be a bug while working with the JDK 1.1.1
  193.   for Linux, please send email to Steve Byrne, sbb@gnu.ai.mit.edu.
  194.  
  195.   Along with your bug report, please include the output of 'ldconfig
  196.   -v', which kernel version you have installed on your machine, and any
  197.   available stack traces.
  198.  
  199.   1.8.  Further Reading
  200.  
  201.   Up to date HOWTOs, mailing lists, supported product lists, and other
  202.   Java-Linux services are available from The Blackdown Organization, at
  203.   http://www.blackdown.org/java-linux.html
  204.   <http://www.blackdown.org/java-linux.html>.
  205.  
  206.   Please forward any questions or suggestions about these resources to
  207.   karl@blackdown.com.
  208.  
  209.   A wealth of Java information is available directly from JavaSoft, at
  210.   http://www.javasoft.com <http://www.javasoft.com>.
  211.  
  212.   2.  JDK-1.1.1 Release Notes
  213.  
  214.   2.1.  jdb
  215.  
  216.   The debugger ("jdb") packaged with the JDK requires an active network
  217.   interface to function. Since most dialup machines only have the
  218.   loopback ("127.0.0.1") interface active when not connected to the
  219.   internet, the jdb runs into problems. The jdb attempts to connect to
  220.   the address that corresponds to your machine's hostname, finds that it
  221.   either can't look it up, or can't reach the address specified in
  222.   /etc/hosts, and fails to start up.
  223.  
  224.   One solution to the problem is to change or alias the address of your
  225.   hostname to ("127.0.0.1"). A more sensible answer is to use a dummy
  226.   device that corresponds to the name and address you have specified for
  227.   your machine in /etc/hosts.
  228.  
  229.   Following is an excerpt from the Network Administrator's Guide that
  230.   will summarize and clarify the functionality of the dummy device
  231.   driver.
  232.  
  233.   The dummy interface is really a little exotic, but rather useful
  234.   nevertheless. Its main benefit is with standalone hosts, and machines
  235.   whose only IP network connection is a dial-up link. In fact, the
  236.   latter are standalone hosts most of the time, too.
  237.  
  238.   The dilemma with standalone hosts is that they only have a single
  239.   network device active, the loopback device, which is usually assigned
  240.   the address 127.0.0.1.  On some occasions, however, you need to send
  241.   data to the `official' IP address of the local host. For instance,
  242.   consider the laptop vlite, that has been disconnected from any network
  243.   for the duration of this example.  An application on vlite may now
  244.   want to send some data to another application on the same host.
  245.   Looking up vlite in /etc/hosts yields an IP-address of 191.72.1.65, so
  246.   the application tries to send to this address. As the loopback
  247.   interface is currently the only active interface on the machine, the
  248.   kernel has no idea that this address actually refers to itself! As a
  249.   consequence, the kernel discards the datagram, and returns an error to
  250.   the application.
  251.  
  252.   This is where the dummy device steps in. It solves the dilemma by
  253.   simply serving as the alter ego of the loopback interface.  In the
  254.   case of vlite, you would simply give it the address 191.72.1.65 and
  255.   add a host route pointing to it. Every datagram for 191.72.1.65 would
  256.   then be delivered locally. The proper invocation is:
  257.  
  258.   ______________________________________________________________________
  259.  
  260.              # ifconfig dummy vlite
  261.              # route add vlite
  262.  
  263.   ______________________________________________________________________
  264.  
  265.   3.  Using Java Binary Format Support in the Linux kernel
  266.  
  267.   3.1.  Configuring the Kernel
  268.  
  269.   In order to make use of Java binary format support with Linux, you
  270.   must configure a kernel with 'Kernel support for ELF binaries'.
  271.  
  272.      Java Support Compiled Into the Kernel
  273.  
  274.      o  If Java support is not compiled as a module, the location of
  275.         your java applications can be specified using the Linux system
  276.         control interface. Otherwise, the java and appletviewer
  277.         applications are expected to be found in /usr/bin.
  278.  
  279.         echo "/usr/local/java/bin/java" > /proc/sys/kernel/java-interpreter
  280.         echo "/usr/local/java/bin/appletviewer" > /proc/sys/kernel/java-appletviewer
  281.  
  282.      Java Support Compiled as a Module
  283.  
  284.      o  If Java support is compiled as a module, the module expects to
  285.         find the java and appletviewer applications in /usr/bin. To work
  286.         around this, simply edit /usr/src/linux/fs/binfmt_java.c and
  287.         modify the following definitions to reflect your setup.
  288.  
  289.                       #define _PATH_JAVA      "/usr/bin/java"
  290.                       #define _PATH_APPLET    "/usr/bin/appletviewer"
  291.  
  292.   3.2.  Making Use of Java Binary Support
  293.  
  294.   In order to use the Java binary support, the following steps must be
  295.   taken with compiled Java code.
  296.  
  297.   o  Compile your java source file as you normally would.
  298.  
  299.   o  Set the execution bit on the generated class file with chmod.
  300.  
  301.   o  Execute the class file as if it were any other executable.
  302.  
  303.   3.3.  Further Reading
  304.  
  305.   Release notes pertaining to Java binary format support in the Linux
  306.   kernel can be found in
  307.   <file:///usr/src/linux/Documentation/java.txt>.
  308.  
  309.   4.  Netscape and Java
  310.  
  311.   4.1.  Netscape 3.0
  312.  
  313.   The fundamental problem with Netscape 3.0, java, and linux machines is
  314.   the use of a Standard C Library compiled with dl-malloc. Using a
  315.   wrapper script and the older gnumalloc, java will for the most part
  316.   cease to crash the browser.
  317.  
  318.   The script also sets a very simple CLASSPATH. Be careful, certain
  319.   CLASSPATH entries can confuse netscape and cause it to crash, as can
  320.   the presence of outdated Netscape class libraries.
  321.  
  322.   ______________________________________________________________________
  323.   #!/bin/sh
  324.   export CLASSPATH="/usr/local/netscape/java/classes/java_301:."
  325.   export LD_PRELOAD="/lib/gnumalloc.so"
  326.   exec /opt/netscape/bin/netscape "$@"  # NOTE! This must be the path to the
  327.                                           real netscape executable, not this
  328.                                           script.
  329.   ______________________________________________________________________
  330.  
  331.   To make this all work, follow these steps:
  332.  
  333.   o  Install netscape
  334.  
  335.   o  Copy the java_30 or java_301 file included with the netscape
  336.      archive to /usr/local/netscape/java/classes/
  337.  
  338.   o  Copy gnumalloc.so to /lib
  339.  
  340.   o  Edit the shell script to match your setup
  341.  
  342.   You can find gnumalloc.so at http://www.blackdown.org/java-
  343.   linux/downloads/gnumalloc.tar.gz <http://www.blackdown.org/java-
  344.   linux/downloads/gnumalloc.tar.gz>. Thanks to Doug Ridgway
  345.   (ridgway@routh.UCSD.EDU) for this tip.
  346.  
  347.   Recently, it has been reported that netscape will also crash with Java
  348.   applets if using versions of libXext.so higher than libXext.so.6.0.
  349.   The solution, is to copy libXext.so.6.0 into a directory such as
  350.   /lib/509/, making the appropriate symbolic links and setting the
  351.   LD_LIBRARY_PATH to look in that directory first.
  352.  
  353.   Geoffrey Dairiki (dairiki@apl.washington.edu) has created a workaround
  354.   for playing sound with Java under Netscape 3.0, which can be found at
  355.   http://irving.apl.washington.edu/~dairiki/libmmoss/libmmoss.html
  356.   <http://irving.apl.washington.edu/~dairiki/libmmoss/libmmoss.html>.
  357.   4.2.  Netscape 4.0
  358.  
  359.   Prior to Netscape 4.0b3 <ftp://ftp.netscape.com/pub/communicator/4.0>,
  360.   no combination of libraries and modules could curb Netscape's desire
  361.   to crash. Version beta3 of Netscape 4.0, however, when used in
  362.   conjunction with libc 5.4.23 and higher, has been verified to work
  363.   without the need for any of the previous workarounds that Netscape 3.0
  364.   necessitated.
  365.  
  366.   5.  Marimba's Tuner, Transmitter, and Bongo
  367.  
  368.   Marimba, Inc. has not yet released versions of the Tuner, Transmitter,
  369.   and Bongo that are compatible with the JDK 1.1.1.
  370.  
  371.